package com.example.design.bilibili.mediator;

/**
 * 中介者模式
 */
public class Client {

    public static void main(String[] args) {
        //创建一个中介者对象
        Mediator mediator = new ConcreteMediator();

        //创建Alarm对象，并加入到ConcreteMediator对象的Map中
        Alarm alarm = new Alarm(mediator,"alarm");
        //创建CoffeeMachine对象，并加入到ConcreteMediator对象的Map中
        CoffeeMachine coffeeMachine = new CoffeeMachine(mediator,"coffeeMachine");
        Curtains curtains = new Curtains(mediator,"curtains");
        TV tv = new TV(mediator,"TV");

        //让闹钟发出消息
        alarm.sendAlarm(0);
        coffeeMachine.finishCoffee();
        alarm.sendAlarm(1);

    }
}
